
#函数定义，带参数
def add(x,y):
    return x+y

#函数默认参数:
def power(x,n=2):
    s=1
    while n>0:
        n=n-1
        s=s*x
    return s

#可变参数
def add2(*numbers):
    s=0
    for x in numbers:
       s=s+x
    return s

#关键字参数：
def person(name, age, *list,**kw):
    print('name:', name, 'age:', age,'list',list, 'other:', kw)

#指定关键字参数
def person2(name, age, *, city, job):
    print('name:', name, 'age:', age, 'city', city, 'job:', job)

print(add(1,2))
print(power(3))
print(add2(1,2,3))

person('xiaoming',10,1,2,3,gender='m')
person2('xiaoming',10,city='',job='')